<cfscript>    
    view = createObject("component", session.rootDir & ".views.layout");
    if( Session.Auth EQ True and (Session.strAuthType EQ Session.MANAGERS or Session.strAuthType EQ Session.IT or Session.strAuthType EQ Session.HR or Session.Manager) ){
        view.init("Step 3:   HR - Contractor Orientation",
            "/jquery/ui-1.8.5/jquery-ui.min.js,/jquery/plugins/scrollTo/jquery.scrollTo-1.4.2-min.js, /" & session.rootDir & "/static/js/NonSCF/Step3-Orientation.js",
            "/jquery/ui-1.8.5/themes/cupertino/jquery-ui.css","Home",index);
    }else{
        view.init("Denied","","","Home","Denied");
    }    
    view.html();
</cfscript>

<cffunction name="index" access="public" output="true" returntype="any">
    <cfscript>
        import models.*;
        FormAction = '/' & Session.RootDir & '/controller/SubmitHandler.cfm?NonSCFStep3=update';
        KronosQueries = CreateObject("component", session.rootDir & ".DatabaseQueries.Kronos");
        CurrentEmployees = KronosQueries.funcGetCurrentEmployees();
        AccessControlQueries = CreateObject("component", session.rootDir & ".DatabaseQueries.AccessControl");
        JustinsJobProg = CreateObject("component", session.rootDir & ".DatabaseQueries.JustinsJobProg");
        StepAction = entityLoadByPK("StepActions", URL.StepID);
        Employee = entityLoadByPK("Employee", StepAction.getEmployeeID());
        GetNonSCFTypes = EntityLoad("NonSCFTypes");
        GetContainer = EntityLoad("ADContainer");
        GetDepts = KronosQueries.funcGetDepts();
        GetAccess = AccessControlQueries.funcGetAccess();
    </cfscript>
    
    <cfoutput> 
    <h1 class="title">Step 3:   HR - Contractor Orientation</h1>
        <div class="entry">    
            Welcome, #Session.EmpInfo.FirstName# #Session.EmpInfo.LastName#.  
            On this page you'll be asked to review the information provided by the requesting contract supervisor. <br /><br /> 

            <cfform name="frmStep2" method="post" action="#FormAction#">
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                <fieldset>
                                    <legend><strong>Information provided by the Contract Supervisor:</strong></legend>
                                    <table>
                                        <tr>
                                            <td width ="10">&nbsp;</td>
                                            <td>Employee to Hire:</td>
                                            <td>#Employee.getFullName()#</td>
                                        </tr>
                                        <tr>
                                            <td width = "10">&nbsp;</td>
                                            <td>&nbsp;&nbsp;&nbsp;&nbsp;First, MI, Last:</td>
                                            <td>
                                                <cfinput type="text" name="FirstName" error_message="Please provide a first name for this individual." tabindex="5" value="#Employee.getFirstName()#">
                                                <cfinput type="text" name="MiddleName" size=1 maxlength="2" tabindex="7" value="#Employee.getMiddleName()#">                         
                                                <cfinput type="text" name="LastName" error_message="Please provide a last name for this individual." tabindex="10" value="#Employee.getLastName()#">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>&nbsp;</td>
                                            <td>&nbsp;&nbsp;&nbsp;&nbsp;Preferred Name:</td>
                                            <td><cfinput type="text" name="PreferredName" tabindex="15" value="#Employee.getPreferredName()#"></td>
                                        </tr>
                                        <tr>
                                            <td>&nbsp;</td>
                                            <td>&nbsp;&nbsp;&nbsp;&nbsp;SSN:</td>
                                            <td>
                                                <cfinput type="text" name="SSN" tabindex="17" value="#Employee.getSSN()#" error_message="Please provide a valid SSN for this individual.">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>&nbsp;</td>
                                        </tr>
                                        <tr>
                                            <td>&nbsp;</td>
                                            <td>Requestors Comments:</td>
                                            <td>
                                                <cfif len(trim(StepAction.getNotes())) GT 0 >
                                                    #StepAction.getNotes()#
                                                <cfelse>
                                                    <span class="error">None</span>
                                                </cfif>
                                            </td>                                
                                        </tr>
                                        <tr>
                                            <td>&nbsp;</td>
                                        </tr>
                                        <tr>
                                            <td>&nbsp;</td>
                                            <td>Supervisor:</td>
                                            <td>
                                                <cfselect name="SupervisorID" error_message="A supervisor must be chosen from the supervisor drop down list.">
                                                    <option value="0">- None -</option>
                                                    <cfloop query="CurrentEmployees">
                                                        <cfset fullName = '#Trim(CurrentEmployees.LastName)#, #Trim(CurrentEmployees.FirstName)#'/>                            
                                                        <option value="#CurrentEmployees.RosettaID#">
                                                            #fullName# (#CurrentEmployees.Title#)                                                    
                                                        </option>
                                                    </cfloop>
                                                </cfselect>
                                            </td>
                                        </TR>
                                        <TR>
                                            <td>&nbsp;</td>
                                            <TD>Department:</TD>
                                            <TD colspan=3>
                                                <cfselect name="DepartmentID" query="GetDepts" tabindex="20" value="OrgCodeIDNo" display="Org" Selected ="#Employee.getDepartmentID()#"/>
                                            </TD>
                                        </TR>   
                                        <tr>
                                            <td>&nbsp;</td>
                                            <td>Non-SCF Type:</td>
                                            <td>
                                                <cfselect name="NonSCFTypeID" tabindex="25" >
                                                    <cfloop from="1" to="#ArrayLen(GetNonSCFTypes)#" index='i'>
                                                        <option value="#GetNonSCFTypes[i].getNonSCFTypeID()#" <cfif Employee.getNonSCFTypeID() EQ GetNonSCFTypes[i].getNonSCFTypeID()>selected=selected</cfif>>
                                                            #GetNonSCFTypes[i].getNonSCFType()#
                                                        </option>
                                                    </cfloop>
                                                </cfselect>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>&nbsp;</td>
                                            <td>Company Name:</td>
                                            <td>
                                                <cfinput type="text" name="CompanyName" tabindex="40" tooltip="'Volunteer' or Contracted Company Name." value="#Employee.getCompanyName()#"
                                                    error_message="Please provide a Company for this individual.  Type 'Volunteer' for volunteers or use the Company the contractor works for." >
                                            </td>
                                        </tr>
                                        <TR>
                                            <td>&nbsp;</td>
                                            <TD valign="top"> Actual Start Date:</TD>
                                            <TD>
                                                <cfinput type="hidden" name="EstStartDate" value="#DateFormat(Employee.getEstStartDate(), 'mm/dd/yyyy')#"
                                                    error_message="The Expiration Date cannot exceed 6 months from the current day."/>
                                                <div id="EstStartDate_datepicker"></div>                                                
                                            </TD>
                                        </TR>  
                                        <tr>
                                            <td colspan="4">
                                                <fieldset>
                                                <legend><strong>Network Account and Badge Information:</strong></legend>
                                                    <table>
                                                        <tr>
                                                            <td colspan=5>
                                                                <cfset checked = (Employee.getNonSCFNetworkAccount() eq 1 ? "yes" : "no") />
                                                                <cfinput type="checkbox" id="NonSCFNetworkAccount" name="NonSCFNetworkAccount" tabindex="60" checked="#checked#"> Network Account<br />
                                                                <div ID="NonSCFNetworkAccount" >
                                                                    <table>
                                                                        <cfinput type="hidden" name="MirrorAccountID" value="#Employee.getMirrorAccountID()#" />
                                                                        <tr>
                                                                            <td width="25">&nbsp;</td>
                                                                            <td>Phone Ext:</td>
                                                                            <td>                                                                        
                                                                                <cfinput type="text" name="DeskPhone" maxlength="6" tabindex="80" tooltip="If a phone already exists at the employees work station, what is the 4 digit extension?" 
                                                                                    value="#Employee.getDeskPhone()#">
                                                                            </td>
                                                                        </tr>
                                                                        <TR>
                                                                            <td>&nbsp;</td>
                                                                            <TD>Location/Container:</TD>
                                                                            <TD>
                                                                                <cfselect name="ContainerID" tabindex="90">
                                                                                    <cfloop from="1" to="#ArrayLen(GetContainer)#" index="i">
                                                                                        <option value="#GetContainer[i].getADContainerID()#" <cfif Employee.getContainerID() EQ 7>selected=selected </cfif>>#GetContainer[i].getContainer()#</option>
                                                                                    </cfloop>
                                                                                </cfselect>
                                                                            </TD>
                                                                        </TR>
                                                                   </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan=5>
                                                                <cfset checked = (Employee.getNonSCFBadge() eq 1 ? "yes" : "no") />
                                                                <cfinput type="checkbox" id="NonSCFBadge" name="NonSCFBadge" tabindex="100" checked="#checked#"> Badge<br />
                                                                <div ID="NonSCFBadge" Name="NonSCFBadge">
                                                                    <table>
                                                                        <tr>
                                                                            <td width="25">&nbsp;</td>
                                                                            <td valign="top">Position (Badge):</td>
                                                                            <td>
                                                                                <cfinput type="text" name="BadgePos" tabindex="110" tooltip="Enter the Position as it should appear on the Badge" value="#Employee.getBadgePos()#" 
                                                                                    style="width:98%" error_message="Please enter the Position as it should appear on the Badge.">
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>&nbsp;</td>
                                                                            <td valign="top">Badge Level Access:</td>
                                                                            <td>
                                                                                <cfselect name="BadgeAccessLevelID" tabindex="105"  multiple="yes">
                                                                                    <cfif arrayLen(listtoArray(Employee.getBadgeAccessLevelID())) GT 0>
                                                                                        <option id="0">-- None --</option>
                                                                                    <cfelse>
                                                                                        <option id="0" selected="selected">-- None --</option>
                                                                                    </cfif>
                                                                                    <cfloop query="GetAccess">
                                                                                        <cfif arrayLen(listtoArray(Employee.getBadgeAccessLevelID())) GT 0>
                                                                                            <cfset Selected = "">
                                                                                            <cfloop from='1' to='#arrayLen(listtoArray(Employee.getBadgeAccessLevelID()))#' index="i">
                                                                                                <cfset accessList = listtoArray(Employee.getBadgeAccessLevelID()) />
                                                                                                <cfif AccessLvID EQ accessList[i]>
                                                                                                    <cfset Selected = "selected=Selected">
                                                                                                </cfif>
                                                                                            </cfloop>
                                                                                            <option value="#AccessLvID#" #Selected#>#Descript#</option>
                                                                                        <cfelse>
                                                                                            <option value="#AccessLvID#">#Descript#</option>
                                                                                        </cfif>                                                                                        
                                                                                    </cfloop>
                                                                                </cfselect>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>   
                                                    </table>
                                                </fieldset>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>&nbsp;</td>
                                        </tr> 
                                        <TR>
                                            <td>&nbsp;</td>
                                            <TD valign="top">Comments:</TD>
                                            <TD colspan=3>
                                                <cftextarea rows="2" tabindex="130" name="Comments" style="width:98%" value="#StepAction.getNotes()#"/>
                                            </TD>
                                        </TR>                             
                                    </table>     
                                </fieldset>
                            </td>
                        </tr>
                        <tr>
                            <td>&nbsp;
                                
                            </td>
                       </tr>
                        <tr>
                            <td colspan="5" align="right" valign="middle" style="padding-top:5px;">
                                <cfinput type="hidden" name="EmpID" value="#Employee.getEmployeeID()#">
                                <cfinput type="hidden" name="StepID" value="#URL.StepID#">
                                <cfinput type="hidden" name="FormAction" value="#FormAction#">
                                <cfinput type="button" name="Submit" value="Next >>" tabindex="150">
                            </td>
                        </tr>
                </table>
            </cfform>            
        </div>    
    </cfoutput>
    
</cffunction>